package cn.tang.tframe.springredis;

import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SessionCallback;
import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.data.redis.serializer.RedisSerializer;

import java.util.List;

/**
 * Created by tanghc
 */
public interface ISpringRedisCache<V> extends IRedisRepository<String,V> {

	public RedisTemplate<String, V> getRedisTemplate();

	public boolean setNX(final String key, final V value);

	public <T> T execute(final RedisScript<T> script, final List<String> keys, final Object... args);

	public <T> T execute(final RedisScript<T> script, final RedisSerializer<?> argsSerializer, final RedisSerializer<T> resultSerializer,
						 final List<String> keys, final Object... args) ;

	<T> T execute(RedisCallback<T> action);
	<T> T execute(SessionCallback<T> session);

	String wrapPrefix(String key);
}
